package main

import (
	"fmt"
	"sync"
)

/**
  channel是引用类型
 */
func main() {

	wg := sync.WaitGroup{}
	wg.Add(10)

	for i:=0;i<10;i++  {
		go Go(&wg,i)

	}
	wg.Wait()
}

/**
  wg: 值拷贝
 */
func Go(wg *sync.WaitGroup,index int)  {
	a := 1

	for i:=0;i<100000000;i++ {
		a +=i
	}

	fmt.Println(index,a)

	wg.Done()
}